// 
/*

*/
#include<math.h>
#include <iostream>
#include <vector>
#include <stack>
#include<queue>
using namespace std;
vector<int> change(string S)
{
	vector<int>A;
	for (auto j : S)
	{
		//cout << (int)j-48<<" ";
		A.push_back((int)j-48);
	}
	return A;
}
int main()
{
	int n,m,i,j;
	vector<int>A;
	cin >> n;
	if (n == 0)
	{
		return 0;
	}
	string s;
	cin >> s;
	A = change(s);

	bool flag = 1;
	while (flag)
	{
		flag = 0;
		for (i = 0; i < A.size() - 1; i++)
		{
			if (A[i] + A[i + 1] == 10)
			{
				A.erase(A.begin() + i, A.begin() + i + 2);
				flag = 1;
				
			}
		}
	}
	cout << A.size();
	//for (auto r : A)
	//{
	//	cout << r;
	//}
}